<template>
  <el-dialog
    :visible.sync="visible"
    :before-close="beforeClose"
    :close-on-click-modal="false"
    append-to-body
    class="dialog-sm"
    top="30px"
    width="80%"
  >
    <el-tabs v-model="active">
      <el-tab-pane label="未受理" name="noInvest">
        <task-approval-temp
          ref="noInvest"
          status="0"
          @success="getTabData"
          :type="type"
        ></task-approval-temp>
      </el-tab-pane>
      <el-tab-pane label="已受理">
        <task-approval-temp
          ref="yesInvest"
          @success="getTabData"
          status="1"
          :type="type"
        ></task-approval-temp>
      </el-tab-pane>
    </el-tabs>
  </el-dialog>
</template>

<script>
import TaskApprovalTemp from '@/bank/views/index/myTask/TaskApprovalTemp'
export default {
  components: {
    TaskApprovalTemp,
  },
  props: {
    visible: Boolean,
    type: String,
  },
  data() {
    return {
      active: 'noInvest',
    }
  },
  computed: {},
  watch: {
    visible() {
      if (this.visible) {
        this.active = 'noInvest'
        this.getTabData()
      }
    },
  },
  mounted() {},
  created() {},
  methods: {
    beforeClose() {
      this.$emit('update:visible', false)
    },
    getTabData() {
      this.$nextTick(() => {
        this.$refs.noInvest.getData()
        this.$refs.yesInvest.getData()
      })
    },
  },
}
</script>
<style lang="scss" scoped></style>
